<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>商品信息管理</title>
    <link rel="stylesheet" th:href="@{/static/plugins/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/css/manage/style.css}" media="all">
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 15px;">
                <form class="layui-form layui-form-pane" action="">
                    <input name="productId" th:value="${obj?.productId}" class="layui-input layui-hide"/>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品编码</label>
                        <div class="layui-input-block">
                            <input type="text" name="productCore" th:value="${obj?.productCore}" lay-verify="required" placeholder="请输入商品编码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="productName" th:value="${obj?.productName}" lay-verify="required" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">一级分类</label>
                        <div class="layui-input-block">
                            <!--新增商品 一级分类选中-->
                            <th:block th:if="${obj?.oneCategoryId == null}">
                               <select name="oneCategoryId" id="oneCategoryId" lay-verify="required">
                                   <option value="0" th:placeholder="请选择"></option>
                                   <option value="0" >无</option>
                                   <th:block th:each="productCategory : ${productCategoryList}">
                                       <option th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                   </th:block>
                               </select>
                           </th:block>
                          <!--  编辑商品-->
                          <th:block th:if="${obj?.oneCategoryId != null}">
                              <select name="oneCategoryId" id="oneCategoryId" lay-verify="required">
                                  <option value="0" th:placeholder="请选择"></option>
                                  <option value="0" >无</option>
                                  <th:block th:each="productCategory : ${productCategoryList}">
                                      <div th:if="${productCategory.categoryId} != ${obj?.oneCategoryId}">
                                          <option th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                      </div>
                                      <div th:if="${productCategory.categoryId} == ${obj?.oneCategoryId}">
                                          <option selected th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                      </div>
                                  </th:block>
                              </select>
                          </th:block>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">二级分类</label>
                        <div class="layui-input-block">
                            <th:block th:if="${obj?.twoCategoryId == null}">
                                <select name="twoCategoryId" id="twoCategoryId" lay-verify="required">
                                    <option value="0" th:placeholder="请选择"></option>
                                    <option value="0" >无</option>
                                    <th:block th:each="productCategory : ${productCategoryList}">
                                        <option th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                    </th:block>
                                </select>
                            </th:block>
                            <th:block th:if="${obj?.twoCategoryId != null}">
                                <select name="twoCategoryId" id="twoCategoryId" lay-verify="required">
                                    <option value="0" th:placeholder="请选择"></option>
                                    <option value="0" >无</option>
                                    <th:block th:each="productCategory : ${productCategoryList}">
                                        <div th:if="${productCategory.categoryId} != ${obj?.twoCategoryId}">
                                            <option th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                        </div>
                                        <div th:if="${productCategory.categoryId} == ${obj?.twoCategoryId}">
                                            <option selected th:text="${productCategory.categoryName}"  th:value="${productCategory.categoryId}"></option>
                                        </div>
                                    </th:block>
                                </select>
                            </th:block>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品原价</label>
                        <div class="layui-input-block">
                            <input type="text" name="realPrice" th:value="${obj?.realPrice}" lay-verify="required" placeholder="请输入商品原价" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">销售价格</label>
                        <div class="layui-input-block">
                            <input type="text" name="price" th:value="${obj?.price}" lay-verify="required" placeholder="请输入销售价格" autocomplete="off" class="layui-input">
                        </div>
                    </div> <div class="layui-form-item">
                        <label class="layui-form-label">上下架状态</label>
                        <div class="layui-input-block">
                            <select name="publishStatus" id="publishStatus" th:switch="${obj?.publishStatus} ">
                                <option value="0">请选择</option>
                                <div th:case="0">
                                    <option value="0" selected>下架</option>
                                    <option value="1">上架</option>
                                </div>
                                <div th:case="1">
                                    <option value="0">下架</option>
                                    <option value="1" selected>上架</option>
                                </div>
                                <div th:case="*">
                                    <option value="0">下架</option>
                                    <option value="1">上架</option>
                                </div>
                            </select>

                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品描述</label>
                        <div class="layui-input-block">
                            <textarea name="descript" th:text="${obj?.descript}" placeholder="请输入商品描述" autocomplete="off" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">生产日期</label>
                        <div class="layui-input-block">
                            <input type="text" id="productionDate" name="productionDate" th:value="${obj?.productionDate}" readonly lay-verify="required" placeholder="请输入生产日期" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商品有效期</label>
                        <div class="layui-input-block">
                            <input type="text" id="shelfLife" name="shelfLife" th:value="${obj?.shelfLife}" lay-verify="required" placeholder="请输入商品有效期" autocomplete="off" class="layui-input">
                        </div>
                     </div>
                    <div class="layui-form-item layui-hide">
                        <input type="button" lay-submit lay-filter="lay-front-submit" id="lay-front-submit" value="确认">
                    </div>
                </form>
            </div>
        </div>
    </div>
    <script th:src="@{/static/plugins/layui/layui.js}"></script>
    <script th:src="@{/static/js/manage/product/productInfo.js}"></script>
</body>
</html>
















